from fill_in_error import __, assert_equal

# okay, this is the final part(maybe)

# what is class? class is an abstraction of some objects 
# which has same attributes and behaviors

# for example
class Dog:
    pass # pass means do nothing and end
# aha! you've just created a class named Dog!

class Person:
    # init means initialize
    # __init__ is called when we call Person()
    # we use self to refer to the object itself
    def __init__(self, name):
        self.name = name

    def talk(self):
        if self.name == "Sam":
            return "PL is fun!"
        else:
            return "What fuck is PL?"
            

class AboutClass:
    # see class definition on line 9
    def create_an_object_of_a_class():
        dog = Dog()
        
    # see class definition on line 13
    def create_an_object_with_argument():
        sam = Person("Sam")
        
    def access_attribute_of_an_object():
        sam = Person("Sam")
        assert_equal(sam.name, __)

        sam.name = "SamNi"
        assert_equal(sam.name, __)

    def call_method_of_an_object():
        sam = Person("Sam")
        assert_equal(sam.talk(), __)

        bob = Person("Bob")
        assert_equal(bob.talk(), __)


# congratulations! you finished the tutorial!
# now the final step is to understand the classes below!
# once you've finished this, you can read and write abaqus code!

class Material:
    def __init__(self):
        self.density = None
        self.elastic = None
    # we don't care about the details of Dentisy and Elastic
    class _Density:
        pass
    class _Elastic:
        pass
    def Density(self):
        self.density = self._Density()
    def Elastic(self):
        self.elastic = self._Elastic()

class Model:
    def __init__(self):
        self.materials = {}
    def Material(self, name):
        self.materials[name] = Material()

class ModelDatabase:
    def __init__(self):
        self.models = {}
    def Model(self, name):
        self.models[name] = Model()